<template>
  <view class="service-options">
    <view 
      v-for="(option, index) in options" 
      :key="index"
      class="option-item"
      :class="{'option-item--active': selectedIndex === index}"
      @click="selectOption(index)"
    >
      <view class="option-info">
        <text class="option-name">{{ option.name }}</text>
        <text class="option-desc">{{ option.description }}</text>
      </view>
      <text class="option-price">{{ option.price }}</text>
    </view>
  </view>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue';

const props = defineProps({
  options: {
    type: Array,
    default: () => []
  },
  selectedIndex: {
    type: Number,
    default: -1
  }
});

const emit = defineEmits(['select']);

const selectOption = (index) => {
  emit('select', index);
};
</script>

<style lang="scss" scoped>
.option-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #f5f5f5;
  
  &:last-child {
    border-bottom: none;
  }
  
  &--active {
    background-color: #f0fff0;
  }

  .option-info {
    flex: 1;
  }

  .option-name {
    font-size: 15px;
    color: #333;
    margin-bottom: 5px;
    display: block;
  }

  .option-desc {
    font-size: 12px;
    color: #999;
    display: block;
  }

  .option-price {
    font-size: 16px;
    color: #f56c6c;
    font-weight: bold;
  }
}
</style>
